<template>
  <div class="box">
    <van-icon
      name="dituguanli"
      class="iconfont icon_top map"
      class-prefix="icon"
      size="30"
      color="#fff"
    />
    <van-swipe
      class="my-swipe"
      :autoplay="3000"
      indicator-color="white"
      style="height: 200px"
    >
      <van-swipe-item v-for="item in res.body" :key="item.id" class="ab">
        <img :src="url + item.imgSrc" alt="" />
      </van-swipe-item>
    </van-swipe>
    <div class="shu">
      <div class="input_box" @click="fn">
        <div class="input_left">
          <p>北京</p>
          <van-icon
            name="xialakuangxiala"
            class="iconfont icon_top"
            class-prefix="icon"
            size="25"
            color="#808181"
          />
          <span></span>
          <van-icon name="search" class="icon_foot" color="#ccc" size="22" />
        </div>
        <input
          type="text"
          class="input_search"
          placeholder="请输入小区或地址"
        />
      </div>
    </div>

    <van-grid :icon-size="36" style="height: 105px">
      <van-grid-item class="zhaofangzi">
        <van-icon
          name="zufang1"
          class="iconfont icon_top wuzi"
          class-prefix="icon"
          size="35"
          color="#27b97c"
        />
        <p>整租</p>
        <div class="xiaozu"></div>
      </van-grid-item>

        <van-grid-item class="zhaofangzi">
        <van-icon
          name="yunxuhezu"
          class="iconfont icon_top wuzi"
          class-prefix="icon"
          size="35"
          color="#27b97c"
        />
        <p>合租</p>
        <div class="xiaozu"></div>
      </van-grid-item>
         <van-grid-item class="zhaofangzi">
        <van-icon
          name="dituguanli"
          class="iconfont icon_top wuzi"
          class-prefix="icon"
          size="35"
          color="#27b97c"
        />
        <p>地图找房</p>
        <div class="xiaozu"></div>
      </van-grid-item>
         <van-grid-item class="zhaofangzi"   @click="$router.push('/fangyuan')">
        <van-icon
          name="zufang"
          class="iconfont icon_top wuzi"
          class-prefix="icon"
          size="35"
          color="#27b97c"
        />
        <p>去出租</p>
        <div class="xiaozu"></div>
      </van-grid-item>
   
    </van-grid>

    <div class="group">
      <p class="aa">租房小组</p>
      <p>更多</p>
    </div>

    <div class="aaaa">
      <div class="aaa">
        <div><img :src="url + body[0].imgSrc" alt="" /></div>
        <p>家住回龙观归属的感觉</p>
      </div>
      <div class="aaa">
        <div><img :src="url + body[1].imgSrc" alt="" /></div>
        <p>宜居四五环大都市生活</p>
      </div>
    </div>
    <div class="aaaa bbbb">
      <div class="aaa">
        <div><img :src="url + body[2].imgSrc" alt="" /></div>
        <p>喧嚣三里屯繁华的背后</p>
      </div>
      <div class="aaa">
        <div><img :src="url + body[3].imgSrc" alt="" /></div>
        <p>比邻十号线地铁心连心</p>
      </div>
    </div>
  </div>
</template>

<script>
import { swiper, zu } from '@/api/jest'
export default {
  data () {
    return {
      res: '',
      url: 'http://liufusong.top:8080',
      body: ''
    }
  },
  async created () {
    const data = await swiper()
    // console.log(data)
    this.res = data

    const { body } = await zu('AREA|88cff55c-aaa4-e2e0')
    // console.log(body);
    this.body = body
    // console.log(this.body);
  },
  methods: {
    fn () {
      this.$router.push('/list')
    }
  }
}
</script>

<style scoped lang="less">
.zhaofangzi {
  position: relative;
  .xiaozu {
    position: absolute;
    border-radius: 50%;
    top: 10px;
    left: 17px;
    width: 60px;
    height: 60px;
    background-color: #f2fbf7;
  }
  .wuzi {
    z-index: 99999;
    margin-top: 6px;
  }
  p {
    margin-top: 20px;
  font-size: 14px;
  }
}

.input_box {
  display: flex;
  margin-left: 4px;
  margin-top: 3px;
  height: 34px;
  border-radius: 5px;
  .input_left {
    display: flex;
    background-color: #fff;
    width: 100px;
    border-radius: 3px 0 0 3px;
    .icon_top {
      color: #000;
      z-index: 8888888;
      margin-top: 7px;
    }
    p {
      height: 38px;
      margin-top: 8px;
      font-size: 16px;
      margin-left: 6px;
    }
    span {
      width: 1px;
      height: 20px;
      margin-left: 3px;
      margin-top: 8px;
      background-color: #ccc;
    }
    .icon_foot {
      margin-top: 7px;
      margin-left: 8px;
    }
  }
  .input_search {
    width: 190px;
    border-radius: 0 3px 3px 0;
    border: 0px;
  }
  .input_search::placeholder {
    padding-left: 10px;
    color: #ccc;
    font-size: 14px;
  }
}

.box {
  position: relative;
  background-color: #f6f5f6;
  .map {
    position: absolute;
    top: 22px;
    right: 20px;
    z-index: 88888;
    color: #fff;
  }
}

.my-swipe .van-swipe-item {
  color: #fff;
  font-size: 20px;
  line-height: 180px;
  text-align: center;
  background-color: #39a9ed;
}
.ab {
  img {
    width: 100%;
    height: 100%;
  }
}
.shu {
  position: absolute;
  top: 19px;
  left: 16px;
  input {
    width: 300px;
    height: 34px;
    border: 1px solid rgba(0, 0, 0, alpha);
  }
}
.my-swipe {
  width: 100%;
  height: 160px;
}
.group {
  display: flex;
  justify-content: space-between;
  height: 52px;
  line-height: 52px;
  padding: 0 14px;
  .aa {
    font-weight: 800;
  }
}
.aaaa {
  display: flex;
  justify-content: space-evenly;
  .aaa {
    padding-top: 8px;
    display: flex;
    justify-content: space-around;
    width: 44%;
    height: 70px;
    background-color: #fff;
    border-radius: 3px;
    div {
      img {
        width: 55px;
        height: 55px;
      }
    }
    p {
      margin-top: 5px;
      margin-left: 16px;
    }
  }
}
.bbbb {
  margin-top: 14px;
  padding-bottom: 14px;
}
van-search {
  background: rgba(0, 0, 0, 0.3);
}
</style>
